package jwdt.vo;

import jwdt.common.Constant;

public class InitProDataSourceVo {
	
	private String dataSourceName = "";	
	private String dataSourceType = "";
	private String dataBaseType = "";
	private String driverClass = "";
	private String xaDataSourceClass="";
	private String dialect = "";
	private String dataBaseUrl = "";
	private String userName = "";
	private String passWord = "";
	private String jndiName = "";
	private boolean isDefault = false;
	
	public InitProDataSourceVo(){}

	public InitProDataSourceVo clone(){
		InitProDataSourceVo initProDataSourceVo = new InitProDataSourceVo();
		initProDataSourceVo.setDataSourceName(dataSourceName);
		initProDataSourceVo.setDataSourceType(dataSourceType);
		initProDataSourceVo.setDataBaseType(dataBaseType);
		initProDataSourceVo.setDriverClass(driverClass);
		initProDataSourceVo.setXaDataSourceClass(xaDataSourceClass);
		initProDataSourceVo.setDataBaseUrl(dataBaseUrl);
		initProDataSourceVo.setUserName(userName);
		initProDataSourceVo.setPassWord(passWord);
		initProDataSourceVo.setJndiName(jndiName);
		initProDataSourceVo.setDefault(isDefault);
		return initProDataSourceVo;
	}
	
	public String getDataSourceName() {
		return dataSourceName;
	}

	public void setDataSourceName(String dataSourceName) {
		this.dataSourceName = dataSourceName;
	}

	public String getDataSourceType() {
		return dataSourceType;
	}

	public void setDataSourceType(String dataSourceType) {
		this.dataSourceType = dataSourceType;
	}

	public String getDataBaseType() {
		return dataBaseType;
	}

	public void setDataBaseType(String dataBaseType) {
		this.dataBaseType = dataBaseType;
	}

	public String getDriverClass() {
		return driverClass;
	}

	public void setDriverClass(String driverClass) {
		this.driverClass = driverClass;
	}

	public String getDataBaseUrl() {
		return dataBaseUrl;
	}

	public void setDataBaseUrl(String dataBaseUrl) {
		this.dataBaseUrl = dataBaseUrl;
	}

	public String getUserName() {
		return userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

	public String getPassWord() {
		return passWord;
	}

	public void setPassWord(String passWord) {
		this.passWord = passWord;
	}

	public String getJndiName() {
		return jndiName;
	}

	public void setJndiName(String jndiName) {
		this.jndiName = jndiName;
	}

	public boolean isDefault() {
		return isDefault;
	}

	public void setDefault(boolean isDefault) {
		this.isDefault = isDefault;
	}

	public String getXaDataSourceClass() {
		if("".equals(xaDataSourceClass) && !"".equals(dataBaseType)){
			return Constant.DB_TYPE_XADATASOURCECLASS_MAP.get(dataBaseType);
		}
		return xaDataSourceClass;
	}

	public void setXaDataSourceClass(String xaDataSourceClass) {
		this.xaDataSourceClass = xaDataSourceClass;
	}

	public String getDialect() {
		if("".equals(dialect) && !"".equals(dataBaseType)){
			return Constant.DB_TYPE_DIALECT_MAP.get(dataBaseType);
		}
		return dialect;
	}

	public void setDialect(String dialect) {
		this.dialect = dialect;
	}
	
}
